﻿
using System.Linq;
using System.Security.Cryptography;
using System.Text;

public static partial class Extensions
{
    /// <summary>
    /// 返回字符串的MD5
    /// </summary>
    /// <param name="this"></param>
    /// <returns></returns>
    public static string ToMd5Hash(this string @this)
    {
        var md5 = new MD5Cng();
        var data = md5.ComputeHash(Encoding.Default.GetBytes(@this));
        var pwdmd5 = data.Aggregate(string.Empty, (current, t) => current + t.ToString("x2"));
        return pwdmd5;
    }
}